<template>
  <div>
    <el-table
      ref="currencyTable"
      :data="tableData"
      stripe
      style="width: 100%"
      @selection-change="getSelectVal"
    >
      <el-table-column
        type="selection"
        width="55"
        align="center"
      ></el-table-column>
      <el-table-column prop="bizCode" label="编码"></el-table-column>
      <el-table-column prop="title" label="名称"></el-table-column>
      <el-table-column prop="isDefault" label="是否为默认结算方式">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.isDefault === 1" type="success">是</el-tag>
          <el-tag v-else-if="scope.row.isDefault === 2" type="danger"
            >否</el-tag
          >
          <span v-else>--</span>
        </template>
      </el-table-column>
      <el-table-column prop="isDisabled" label="是否禁用">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.isDisabled === 1" type="danger">是</el-tag>
          <el-tag v-else-if="scope.row.isDisabled === 2" type="success"
            >否</el-tag
          >
          <span v-else>--</span>
        </template>
      </el-table-column>
      <el-table-column prop="isSupportLinePay" label="是否支持网银付款">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.isSupportLinePay === 1" type="success"
            >是</el-tag
          >
          <el-tag v-else-if="scope.row.isSupportLinePay === 2" type="danger"
            >否</el-tag
          >
          <span v-else>--</span>
        </template>
      </el-table-column>
      <el-table-column prop="isPayFee" label="是否支付手续费">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.isPayFee === 1" type="success">是</el-tag>
          <el-tag v-else-if="scope.row.isPayFee === 2" type="danger">否</el-tag>
          <span v-else>--</span>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      class="pagination mt10"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
      background
    >
    </el-pagination>
  </div>
</template>

<script>
import { getSettleData } from "@/api/base/data";
export default {
  data() {
    return {
      tableData: [],
      currentPage: 1, //当前页
      pageSize: 10, //每页条数
      total: 0,
    };
  },
  methods: {
    //分页器size
    handleSizeChange(val) {
      this.pageSize = val;
      this.getDataList();
    },
    //分页器当前页
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getDataList();
    },
    getSelectVal(val) {
      if (val.length) {
        this.$emit("update:visible", false);
        this.$emit("getSelectVal", val);
      }
    },
    getDataList() {
      getSettleData().then((res) => {
        this.tableData = res.rows;
        this.total = res.total;
      });
    },
  },
  mounted() {
    this.getDataList();
  },
};
</script>

<style></style>
